package com.woniuxy.listenner;


import com.woniuxy.entity.foodinfo;
import com.woniuxy.service.FoodService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class ListenOrderDead {
@Autowired
 private FoodService foodService;

    @RabbitListener(queues = "dead.letter.queue")
    public void listen(Map<Object,Object> msg) {
        System.out.println("死信队列监听到的消息：" + msg);
        String id= msg.get("userinfoId").toString();
        foodinfo fi= foodService.findfoodinfoByUserinfoId(id);
        if (fi != null && "待支付".equals(fi.getStatus())) {
            foodService.updateByUserinfoId2(id);
        }



    }

}
